package cn.itsource.service.remote;

import cn.dev33.satoken.stp.StpUtil;
import cn.itsource.admin.dto.CancelAndComplaintDto;
import cn.itsource.api.DriverRemoteApi;
import cn.itsource.mapper.DriverSummaryMapper;
import cn.itsource.pojo.domain.DriverSummary;
import cn.itsource.result.JSONResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class DriverRemoteImpl implements DriverRemoteApi {
    @Autowired
    private DriverSummaryMapper driverSummaryMapper;
    @Override
    public JSONResult getCancelAndComplaint() {
        // 查询司机的总投诉撤单数
        DriverSummary driverSummary = driverSummaryMapper.selectById(StpUtil.getLoginIdAsLong());
        CancelAndComplaintDto cancelAndComplaintDto = new CancelAndComplaintDto( driverSummary.getTodayComplaint(),driverSummary.getTodayCancel());
        return JSONResult.success(cancelAndComplaintDto);
    }
}